﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.IO;
using System.Configuration;
using VsxFactory.Modeling.Repository;

namespace VsxFactory.Repository.StrategiesGallery
{
    class ServerSettings : VsxFactory.Modeling.Strategies.SettingsBase
    {
        private readonly string _folder;

        public ServerSettings()
        {
            string str = ConfigurationManager.AppSettings["repositoryFolder"];
            if (!String.IsNullOrEmpty(str))
                _folder = str;
            else if (HttpContext.Current != null)
                _folder = HttpContext.Current.Server.MapPath("~/App_Data");
            else
                _folder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), VsxFactory.Modeling.VsxFactoryConstants.Name + @"\Repository");
        }

        public override string Folder
        {
            get { return _folder; }
        }

        public override PackageSource DefaultRepositorySource
        {
            get { throw new NotImplementedException(); }
        }
    }
}
